package com.android.hidephotosplus.util;

import java.io.File;
import java.util.Map;

import android.app.ActivityManager;
import android.content.Context;
import android.os.Environment;
import android.util.Log;
import android.widget.Toast;

import com.nostra13.universalimageloader.core.ImageLoader;

public class Config {

	protected ImageLoader imageLoader = ImageLoader.getInstance();

	public static final String KEY_ALBUM_STOCK = "key_album_stock";
	
	public static final String KEY_ALBUM_HIDDEN = "key_album_hidden";
	
	public static final String KEY_ID_ALBUM_STOCK = "key_id_album_stock";

	public static final String KEY_ID_ALBUM_HIDDEN = "key_id_album_hidden";

	public static final String ACTION_ON_CLICK_ACTIONMODE = "action_on_click_actionmode";

	public static final String ACTION_SEND_ARR_ALBUM_STOCK_TO_HIDDEN = "action_send_arr_album_stock";

	public static final String ACTION_SEND_NAME_ALBUM_TO_STOCK = "action_send_name_album_to_stock";

	public static final String ACTION_SEND_NAME_ALBUM_TO_HIDDEN = "action_send_name_album_to_hidden";

	public static final String KEY_NAME_ALBUM_STOCK = "key_name_album_stock";

	public static final String KEY_NAME_ALBUM_HIDDEN = "key_name_album_hidden";

	public static final String ACTION_SEND_ARR_ALBUM_HIDDEN_TO_STOCK = "action_send_arr_album_hidden_to_stock";

	public static final String ACTION_SEND_POSITON_HIDE_DELETE = "action_send_position_hide_delete";

	public static final String KEY_SEND_POSITON_HIDE_DELETE = "key_send_position_hide_delete";

	public static final String KEY_SEND_ARR_MEDIA_HIDE_DELETE = "key_send_arr_hide_delete";

	public static final String KEY_ARR_ALBUM_STOCK = "key_arr_album_stock";

	public static final String KEY_ARR_ALBUM_HIDDEN = "key_arr_album_hidden";

	public static final String KEY_ARR_MEDIA_STOCK = "key_arr_media_stock";

	public static final String KEY_ARR_MEDIA = "key_arr_media";

	public static final String KEY_ARR_MEDIA_HIDDEN = "key_arr_media_hidden";

	public static final String KEY_IS_PUBLIC = "key_is_public";

	public static final String KEY_POSITION_ARR_MEDIA = "key_position_arr_media";
	
	public static final String KEY_SLIDE_SHOW = "key_slide_show";

	public static final String NONE = "NONE";

	public static final String KEY_NAME_ALBUM = "key_name_album";

	public static final String ACTION_SEND_TYPE_MEDIA = "action_send_type_media";

	public static final String KEY_TYPE_MEDIA = "key_type_media";

	public static final String NOMEDIA = ".nomedia";

	public static final int TYPE_STORAGE_INTERNAL = 1;

	public static final int TYPE_STORAGE_EXTERNAL = 2;

	public static final int TYPE_PHOTO = 1;

	public static final String KEY_NAVIGATION_SELECTED = "key_navigation_selected";

	public static final int TYPE_VIDEO = 2;

	public static final String EXETENSION = ".applus";

	public static final String EXETENSION_VIDEO = ".applusV";

	public static final String EXETENSION_THUMBNAIL = ".applus_Thumb";
	
	public static final String KEY_GET_LIST_HIDDEN = "key_get_list_hidden";
	
	public static final String TEMP = "tmp";
	
	public static final int CLASSIC_PASSWORD = 1;

	public static final int PATTERN_PASSWORD = 2;
	
	
	//REQUEST CODE

	public static final int REQUEST_CODE_ALBUMVIEW_STOCK = 1;

	public static final int REQUEST_CODE_ALBUMVIEW_HIDDEN = 2;

	public static final int REQUEST_CODE_START_ACTIVITY_GALLERY = 3;
	
	public static final int REQUEST_CODE_CAPTURE_IMAGE = 4;
	
	public static final int REQUEST_CODE_SETUP_CLASSIC_PASSWORD = 5;

	public static final int REQUEST_CODE_SETUP_PATTERN_PASSWORD = 6;
	
	public static final int REQUEST_CODE_START_CLASSIC_PASSWORD = 7;

	public static final int REQUEST_CODE_START_PATTERN_PASSWORD = 8;
	
	public static final int REQUEST_CODE_START_ACTIVITY = 9;
	
	public static final int REQUEST_CODE_SHARE_FILE = 10;
	
	public static final int REQUEST_CODE_CAPTURE_VIDEO = 11;

	public static final String KEY_REQUEST_ARR_MEDIA_TO_HIDE = "key_request_arr_media_to_hide";
	
	// KEY_PREFERENCE

	public static final String KEY_POSITION_LIST_NAVIGATION = "key_position_list_navigation";
	
	public static final String KEY_PREF_UNLOCK_TYPE = "unlockType";
	
	public static final String KEY_PREF_CHANGE_PASSWORD = "changePassword";
	
	public static final String KEY_PREF_INVISIBLE = "invisibleMode";
	
	public static final String KEY_PREF_HIDE_ICON_APP = "hideIconApp";
	
	public static final String KEY_CALL_TO_OPEN = "callToOpen";
	
	public static final String KEY_STORAGE = "storage";
	
	public static final String KEY_PREF_POSITION_VIEWPAGER = "key_pref_position_viewpager";
	

	// path

	public static final String PATH_DEFAULT = File.separator + ".HidePhotosPlus"
			+ File.separator;

	public static final String PATH_INTERNAL = Environment
			.getExternalStorageDirectory().getAbsolutePath();

	public static Map<String, File> externalLocations = ExternalStorage
			.getAllStorageLocations();

	public static String PATH_EXTERNAL = getPathExternal();

	public static String getPathExternal() {
		String result = "";
		File mFileExternal = null;
		try {
			mFileExternal = new File(externalLocations.get(
					ExternalStorage.EXTERNAL_SD_CARD).getAbsolutePath());
			if (mFileExternal.exists())
				result = externalLocations
						.get(ExternalStorage.EXTERNAL_SD_CARD)
						.getAbsolutePath();
			else
				result = NONE;
		} catch (Exception e) {
			result = NONE;
		}
		Log.e("result", result + "");
		return result;
	}

	public static String getPathFinal(int type_storage) {
		String result = "";
		if (type_storage == TYPE_STORAGE_INTERNAL)
			result = Config.PATH_INTERNAL + PATH_DEFAULT;
		else
			result = Config.PATH_EXTERNAL + PATH_DEFAULT;
		return result;
	}

	// LoadMEdia

	public static final int MAX_PIXELS_WIDTH = 200;

	public static final int MAX_PIXELS_HEIGHT = 200;

	public static int onSize(Context context) {
		int result = 0;
		int memClass = ((ActivityManager) context
				.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
		result = 1024 * 1024 * memClass / 4;
		return result;
	}

	public static void showToastShort(Context context, String content) {
		Toast.makeText(context, content, Toast.LENGTH_SHORT).show();
	}

	public static void showToastLong(Context context, String content) {
		Toast.makeText(context, content, Toast.LENGTH_LONG).show();
	}
}
